home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / clang / netclb23.zip / EXAMPLES.EXE / STIME.C < prev    next >
C/C++ Source or Header  |  1994-05-20  |  2KB  |  50 lines

  1. /***************************************************************************/
  2. /* File:             STIME.C                                               */
  3. /*                                                                         */
  4. /* Function:         Output current server date and time.                  */
  5. /*                                                                         */
  6. /* Usage:            stime                                                 */
  7. /*                                                                         */
  8. /* Functions Called: GetFileServerDateTime                                 */
  9. /*                   GetPreferredConnectionID                              */
  10. /*                   GetDefaultConnectionID                                */
  11. /*                   GetPrimaryConnectionID                                */
  12. /*                   SetPreferredConnectionID                              */
  13. /*                   ISShellLoaded                                         */
  14. /*                                                                         */
  15. /***************************************************************************/
  16. #include "netware.h"
  17. #include <stdio.h>
  18.  
  19. static char *days[] = { "Sunday" , "Monday" , "Tuesday" , "Wednesday" ,
  20.                         "Thursday" , "Friday" , "Saturday" };
  21. void main( void )
  22. {
  23. int h,m,s,d,mth,y,dow;
  24. int thisserver,prefserver;
  25.  
  26.    if (IsShellLoaded() != SUCCESS)
  27.    {
  28.       printf("*** No netware shell loaded ***\n");
  29.       return;
  30.    }
  31.  
  32.    if ((prefserver = GetPreferredConnectionID()) == 0)
  33.    {
  34.       if ((thisserver = GetDefaultConnectionID()) == 0)
  35.          thisserver = GetPrimaryConnectionID();
  36.       SetPreferredConnectionID( thisserver );
  37.    }  
  38.    else
  39.       thisserver = prefserver;
  40.  
  41.    GetFileServerDateTime(&h,&m,&s,&d,&mth,&y,&dow);
  42.    
  43.    printf("Today is %s\n",days[dow]);
  44.    printf("%02.2d-%02.2d-%04.4d__%02.2d:%02.2d:%02.2d\n",
  45.           d,mth,y,h,m,s);
  46.             
  47.    if (thisserver != prefserver)   /* reset preferred server */
  48.       SetPreferredConnectionID( prefserver );
  49. }
  50.